<template>
    
     
		<div class="spare-a">
			<div class="save-bg"><!-- <a href="javascript:void(0);"  class="spare-tj" onclick="allSearch()">确 定</a> -->
               <button class="spare-tj" @click="toHelpIndex">确定</button>
			   <!--  <router-link class="spare-tj" tag="a" :to="{path:'/help/index',params:{content:this.searchWords}}" @click.native='toHelpIndex'>确定</router-link>--> 
            </div>
			<div class="spare-add">
				<ul>
					<li>
						<div class="spare-addl">关键字：</div>
						<div class="spare-addr">
							<textarea class="spare-add-textarea" placeholder="多个关键字请以英文 , 隔开" id="searchWords" v-model="searchWords"></textarea>
						</div>
					</li>
					<li>
						<div class="spare-addl">搜素方式：</div>
						<div class="spare-addr">
							<select class="spare-add-select" id="searchType" v-model="searchType">
								<option value="1">匹配所有词</option>
								<option value="2">匹配任意词</option>
								<option value="3">精确搜索</option>
								<option value="4">排除搜索</option>
							</select>
							<div class="select-arrow"></div>
						</div>
					</li>
					<li>
						<div class="spare-addl">搜素范围：</div>
						<div class="spare-addr">
							<select class="spare-add-select" id="projectList" placeholder="多个关键字请以英文 , 隔开" v-model="pmCode" @change="changePmCode">
								<option value="1" selected>所有手册</option>
								<option :value="item.code" v-for="item in pmCodeList" :key="item.id">{{item.code}}</option>
							</select>
							<div class="select-arrow"></div>
						</div>
					</li>
					<li>
						<div class="spare-addl">型号识别码：</div>
						<div class="spare-addr">
							<select class="spare-add-select" id="modelIdentCodeList" v-model="modelIdentCode" @change="changeModelIdentCode">
								<option value="1" selected>任意</option>
                                <option :value="item.modelIdentCode" v-for="item in modelIdentCodeLists" :key="item.modelIdentCode">{{item.modelIdentCode}}</option>
							</select>
							<div class="select-arrow"></div>
						</div>
					</li>
					<li>
						<div class="spare-addl">系统：</div>
						<div class="spare-addr">
							<select class="spare-add-select" id="systemCodeList" v-model="systemCode" @change="changeSystemCode">
								<option value="1" selected>任意</option>
                                <option :value="item.systemCode" v-for="item in systemCodeLists" :key="item.systemCode">{{item.systemCode}}</option>
							</select>
							<div class="select-arrow"></div>
						</div>
					</li>
					<li>
						<div class="spare-addl">分系统：</div>
						<div class="spare-addr">
							<select class="spare-add-select" id="subSystemCodeList" v-model="subSystemCode" @change="changeSubSystemCode">
								<option value="1" selected>任意</option>
                                <option :value="item.subSystemCode" v-for="item in subSystemCodeLists" :key="item.subSystemCode">{{item.subSystemCode}}</option>
							</select>
							<div class="select-arrow"></div>
						</div>
					</li>
					<li>
						<div class="spare-addl">单元：</div>
						<div class="spare-addr">
							<select class="spare-add-select" id="assyCodeList" v-model="assyCode" @change="changeAssyCode">
								<option value="1">任意</option>
                                 <option :value="item.assyCode" v-for="item in assyCodeLists" :key="item.assyCode">{{item.assyCode}}</option>
							</select>
							<div class="select-arrow"></div>
						</div>
					</li>
					<li>
						<div class="spare-addl">信息码：</div>
						<div class="spare-addr">
							<select class="spare-add-select" id="infoCodeList" v-model="infoCode">
								<option value="1">任意</option>
                                <option :value="item.infoCode" v-for="item in infoCodeLists" :key="item.infoCode">{{item.infoCode}}</option>
							</select>
							<div class="select-arrow"></div>
						</div>
					</li>
				</ul>
			</div>
		</div>
</template>

<script>
import Help from '../../../store/help.js'
export default {
    data(){
        return {
           searchWords:'',
           searchType:'',
           pmCode:'',
           pmCodeList:[],
           modelIdentCode:'',
           modelIdentCodeLists:[],
           systemCode:'',
           systemCodeLists:[],
           subSystemCode:'',
           subSystemCodeLists:[],
           assyCode:'',
           assyCodeLists:[],
           infoCode:'',
		   infoCodeLists:[],
        }
    },
    methods:{
        getPmCodeList(){
            this.axios.get("/ietm/getProjects").then(res=>{
               this.pmCodeList = res.data;
            })
        },
        changePmCode(){
            //pmCode发生改变触发事件
            this.axios.get("/ietm/getModelIdentCodeList",{params:{pmCode:this.pmCode}}).then(res=>{
              this.modelIdentCodeLists = res.data;
            })
        },
        changeModelIdentCode(){
            //modelIdentCode发生改变触发
             this.axios.get("/ietm/getSystemCodeList",{params:{pmCode:this.pmCode,modelIdentCode:this.modelIdentCode}}).then(res=>{
              this.systemCodeLists = res.data;
            })
        },
        changeSystemCode(){
            //systemCode发生改变触发
              this.axios.get("/ietm/getSubSystemCodeList",{params:{pmCode:this.pmCode,modelIdentCode:this.modelIdentCode,systemCode:this.systemCode}}).then(res=>{
              this.subSystemCodeLists = res.data;
            })
        },
        changeSubSystemCode(){
            //subSystemCode发生改变触发
             this.axios.get("/ietm/getAssyCodeList",{params:{pmCode:this.pmCode,modelIdentCode:this.modelIdentCode,systemCode:this.systemCode,subSystemCode:this.subSystemCode}}).then(res=>{
              this.assyCodeLists = res.data;
            })
        },
        changeAssyCode(){
            //assyCode发生改变触发
             this.axios.get("/ietm/getInfoCodeList",{params:{pmCode:this.pmCode,modelIdentCode:this.modelIdentCode,systemCode:this.systemCode,subSystemCode:this.subSystemCode,assyCode:this.assyCode}}).then(res=>{
              this.infoCodeLists = res.data;
             })
		},
		toHelpIndex(){
			 this.$emit('returnflag',false);
			 Help.$emit('val', {content:this.searchWords,
								pmCode:this.pmCode,
								modelIdentCode:this.modelIdentCode,
								systemCode:this.systemCode,
								subSystemCode:this.subSystemCode,
								assyCode:this.assyCode,
								infoCode:this.infoCode,
								  });
			this.searchWords=''
			//this.$router.push({path:'/help/index',params:{content:this.content}})
			/*  Bus.$emit('content', this.searchWords);
			 Bus.$emit('pmCode', this.pmCode); */
			 
		}
    },
    created(){
        this.getPmCodeList();
<<<<<<< HEAD
	},
	watch:{
		$route(to,from)
		{
			if(to.path=='Help')
			{
				this.searchWords='';
				this.searchType='';
				this.pmCode='';
				this.modelIdentCode='';
				this.systemCode='';
				this.subSystemCode='';
				this.assyCode='';
				this.infoCode='';
			}
		}
=======
>>>>>>> a6a7a3e6dd8d520bcb5786ad2482daf2e665c0d9
	}
}
</script>

<style scoped>
@import url('../../../assets/css/content.css');
@import url('../../../assets/css/animation.css');
</style>